Collaborators: Shane Blowes, Jon Chase, Helmut Hillebrand, Michael Burrows, Amanda Bates, Uli Brose, Benoit Gauzens, Laura Antao, Ruben Remelgado, Carsten Meyer, Myriam Hirt, maybe others Assistance: Katherine Lew, Josef Hauser
library(data.table) # for handling large datasets
library(ggplot2) # for some plotting
library(nlme) # for ME models
library(maps) # for map
library(gridExtra) # to combine ggplots together
library(grid) # to combine ggplots together
library(RColorBrewer)
library(MASS) # for stepAIC
options(width=500) # turn off most text wrapping
# tell RStudio to use project root directory as the root for this notebook. Needed since we are storing code in a separate directory.
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
# Turnover and covariates assembled by turnover_vs_temperature_prep.Rmd
trends <- fread('output/turnover_w_covariates.csv.gz')
# set realm order
trends[, REALM := factor(REALM, levels = c('Freshwater', 'Marine', 'Terrestrial'), ordered = FALSE)]
# set up sign of temperature change
trends[, tsign := factor(sign(temptrend))]
# realm that combined Terrestrial and Freshwater, for interacting with human impact
trends[, REALM2 := REALM]
levels(trends$REALM2) = list(TerrFresh = "Freshwater", TerrFresh = "Terrestrial", Marine = "Marine")
# group Marine invertebrates/plants in with All
trends[, taxa_mod2 := taxa_mod]
trends[taxa_mod == 'Marine invertebrates/plants', taxa_mod2 := 'All']
# calculate duration
trends[, duration := maxyrBT - minyrBT + 1]
# trim to data with >= 3 yrs
trends <- trends[nyrBT >= 3, ]
trends[, tempave.sc := scale(tempave)]
trends[, tempave_metab.sc := scale(tempave_metab)]
trends[, seas.sc := scale(seas)]
trends[, microclim.sc := scale(log(microclim))]
trends[, temptrend.sc := scale(temptrend, center = FALSE)] # do not center
trends[, temptrend_abs.sc := scale(abs(temptrend), center = FALSE)] # do not center, so that 0 is still 0 temperature change
trends[, mass.sc := scale(log(mass_mean_weight))]
trends[, speed.sc := scale(log(speed_mean_weight+1))]
trends[, lifespan.sc := scale(log(lifespan_mean_weight))]
trends[, consumerfrac.sc := scale(consfrac)]
trends[, endothermfrac.sc := scale(endofrac)]
trends[, nspp.sc := scale(log(Nspp))]
trends[, thermal_bias.sc := scale(thermal_bias)]
trends[, npp.sc := scale(log(npp))]
trends[, veg.sc := scale(log(veg+1))]
trends[, duration.sc := scale(log(duration))]
trends[, human_bowler.sc := scale(log(human_bowler+1)), by = REALM2] # separate scaling by realm
trends[REALM2 == 'TerrFresh', human_footprint.sc := scale(log(human_venter+1))]
trends[REALM2 == 'Marine', human_footprint.sc := scale(log(human_halpern))]
Just turnover
cat('Overall # time-series: ', nrow(trends), '\n')
Overall # time-series: 39195
cat('# studies: ', trends[, length(unique(STUDY_ID))], '\n')
# studies: 307
cat('Data points: ', trends[, sum(nyrBT)], '\n')
Data points: 266337
trends[, table(REALM)]
REALM
Freshwater Marine Terrestrial
628 35742 2825
trends[, table(taxa_mod)]
taxa_mod
All Amphibians Benthos Birds
1447 352 4310 8719
Fish Invertebrates Mammals Marine invertebrates/plants
21708 1799 504 104
Plant Reptiles
248 4
trends[, table(taxa_mod, REALM)]
REALM
taxa_mod Freshwater Marine Terrestrial
All 0 1444 3
Amphibians 2 0 350
Benthos 0 4310 0
Birds 0 6542 2177
Fish 610 21098 0
Invertebrates 14 1705 80
Mammals 0 459 45
Marine invertebrates/plants 0 104 0
Plant 1 80 167
Reptiles 1 0 3
With all covariates (Bowler for human)
# the cases we can compare
apply(trends[, .(Jtutrendrem0, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc, temptrend.sc, mass.sc, speed.sc, lifespan.sc, consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)], MARGIN = 2, FUN = function(x) sum(!is.na(x)))
Jtutrendrem0 REALM tempave.sc tempave_metab.sc seas.sc microclim.sc
39195 39195 36747 36747 36747 38291
temptrend.sc mass.sc speed.sc lifespan.sc consumerfrac.sc endothermfrac.sc
36747 39114 39082 38045 39195 39195
nspp.sc thermal_bias.sc npp.sc veg.sc human_bowler.sc
39195 36286 39089 39099 39195
i <- trends[, complete.cases(Jtutrendrem0, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc, temptrend.sc, mass.sc, speed.sc, lifespan.sc, consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)]
cat('Overall # time-series: ', sum(i), '\n')
Overall # time-series: 36017
cat('# studies: ', trends[i, length(unique(STUDY_ID))], '\n')
# studies: 231
cat('Data points: ', trends[i, sum(nyrBT)], '\n')
Data points: 243237
trends[i, table(REALM)]
REALM
Freshwater Marine Terrestrial
608 33098 2311
trends[i, table(taxa_mod)]
taxa_mod
All Amphibians Benthos Birds
1422 12 4288 7198
Fish Invertebrates Mammals Marine invertebrates/plants
20810 1517 495 104
Plant Reptiles
169 2
trends[i, table(taxa_mod, REALM)]
REALM
taxa_mod Freshwater Marine Terrestrial
All 0 1420 2
Amphibians 2 0 10
Benthos 0 4288 0
Birds 0 5116 2082
Fish 597 20213 0
Invertebrates 8 1443 66
Mammals 0 459 36
Marine invertebrates/plants 0 104 0
Plant 1 55 113
Reptiles 0 0 2
Try combinations of
And choose the one with lowest AIC (not run: takes a long time)
# fit models for variance structure
fixed <- formula(Jtutrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*duration.sc +
temptrend_abs.sc*human_bowler.sc:REALM2)
i <- trends[, complete.cases(Jtutrendrem0, temptrend_abs.sc, REALM, tsign, tempave_metab.sc, seas.sc,
microclim.sc, mass.sc, speed.sc, consumerfrac.sc, nspp.sc,
thermal_bias.sc, npp.sc, veg.sc, human_bowler.sc)]
mods <- vector('list', 0)
mods[[1]] <- gls(fixed, data = trends[i,])
mods[[2]] <- gls(fixed, data = trends[i,], weights = varPower(-0.5, ~nyrBT))
mods[[3]] <- gls(fixed, data = trends[i,], weights = varPower(0.5, ~temptrend_abs.sc))
mods[[4]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2, control = lmeControl(opt = "optim"))
mods[[5]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID, control = lmeControl(opt = "optim"))
mods[[6]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID, control = lmeControl(opt = "optim"))
mods[[7]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID/rarefyID, control = lmeControl(opt = "optim"))
mods[[8]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID/rarefyID, control = lmeControl(opt = "optim"))
mods[[9]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc | taxa_mod)
mods[[10]] <- lme(fixed, data = trends[i,], random = list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)) # includes overdispersion. new formula so that random slope is only for study level (not enough data to extend to rarefyID).
mods[[11]] <- lme(fixed, data = trends[i,], random = list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~nyrBT))
mods[[12]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ 1, rarefyID = ~1), weights = varPower(-0.5, ~nyrBT))
aics <- sapply(mods, AIC)
minaics <- aics - min(aics)
minaics
which.min(aics)
Chooses the random slopes (temptrend_abs) & intercepts for STUDY_ID, overdispersion, and variance scaled to number of years. We haven’t dealt with potential testing on the boundary issues here yet.
world <- map_data('world')
ggplot(world, aes(x = long, y = lat, group = group)) +
geom_polygon(fill = 'lightgray', color = 'white') +
geom_point(data = trends, aes(rarefyID_x, rarefyID_y, group = REALM, color = REALM), size = 0.5, alpha = 0.4) +
scale_color_brewer(palette="Set1", name = 'Realm') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=16),
axis.title=element_text(size=20)) +
labs(x = 'Longitude (°)', y = 'Latitude (°)')
Mostly northern hemisphere, but spread all over. Not so much in Africa or much of Asia.
Average rates of turnover (without year 1)
trends[abs(temptrend) >= 0.5, .(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # turnover per year for locations changing temperature
trends[abs(temptrend) < 0.1, .(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # not changing temperature
trends[temptrend >= 0.5, .(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # warming
trends[temptrend <= -0.5, .(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # cooling
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) < 35,
.(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # tropics and sub-tropics
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) >= 35 & abs(rarefyID_y) < 66.56339,
.(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # temperate
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) >= 66.56339,
.(ave = mean(Jtutrendrem0, na.rm=TRUE),
sd = sd(Jtutrendrem0, na.rm=TRUE)/sqrt(.N))] # arctic
i4 <- trends[, complete.cases(Jtutrendrem0, REALM, temptrend)]
randef <- list(STUDY_ID = ~ abs(temptrend), rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
if(file.exists('temp/modonlyTtrendrem0.rds')){
modonlyTtrendrem0 <- readRDS('temp/modonlyTtrendrem0.rds')
} else {
modonlyTtrendrem0 <- lme(Jtutrendrem0 ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i4,], method = 'REML')
saveRDS(modonlyTtrendrem0, file = 'temp/modonlyTtrendrem0.rds')
}
i5 <- trends[, complete.cases(Jbetatrendrem0, REALM, temptrend)]
if(file.exists('temp/modonlyTtrendJbetarem0.rds')){
modonlyTtrendJbetarem0 <- readRDS('temp/modonlyTtrendJbetarem0.rds')
} else {
modonlyTtrendJbetarem0 <- lme(Jbetatrendrem0 ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i5,], method = 'REML',
control=lmeControl(msMaxIter = 100, maxIter = 100))
saveRDS(modonlyTtrendJbetarem0, file = 'temp/modonlyTtrendJbetarem0.rds')
}
i6 <- trends[, complete.cases(Horntrendrem0, REALM, temptrend)]
if(file.exists('temp/modonlyTtrendHornrem0.rds')){
modonlyTtrendHornrem0 <- readRDS('temp/modonlyTtrendHornrem0.rds')
} else {
modonlyTtrendHornrem0 <- lme(Horntrendrem0 ~ abs(temptrend)*REALM,
random = randef, weights = varef, data = trends[i6,], method = 'REML')
saveRDS(modonlyTtrendHornrem0, file = 'temp/modonlyTtrendHornrem0.rds')
}
summary(modonlyTtrendrem0)
Linear mixed-effects model fit by REML
Data: trends[i4, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.007657053 (Intr)
abs(temptrend) 0.197650298 -0.935
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.01097849 2.000161
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.121022
Fixed effects: Jtutrendrem0 ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.807
REALMMarine -0.947 0.764
REALMTerrestrial -0.901 0.727 0.853
abs(temptrend):REALMMarine 0.766 -0.949 -0.814 -0.690
abs(temptrend):REALMTerrestrial 0.733 -0.908 -0.693 -0.810 0.862
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.57101792 -0.22892007 -0.01904447 0.27434430 5.64177564
Number of Observations: 36747
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
292 36747
summary(modonlyTtrendJbetarem0)
Linear mixed-effects model fit by REML
Data: trends[i5, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.005965236 (Intr)
abs(temptrend) 0.160013131 -0.038
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.003861919 0.9688156
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.887978
Fixed effects: Jbetatrendrem0 ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.543
REALMMarine -0.941 0.511
REALMTerrestrial -0.906 0.492 0.852
abs(temptrend):REALMMarine 0.515 -0.948 -0.524 -0.467
abs(temptrend):REALMTerrestrial 0.494 -0.908 -0.464 -0.542 0.861
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.57430409 -0.30896466 -0.02462766 0.32539894 8.23224466
Number of Observations: 36747
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
292 36747
summary(modonlyTtrendHornrem0)
Linear mixed-effects model fit by REML
Data: trends[i6, ]
Random effects:
Formula: ~abs(temptrend) | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.01201968 (Intr)
abs(temptrend) 0.25314398 0.016
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.01882813 2.441788
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.318769
Fixed effects: Horntrendrem0 ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.472
REALMMarine -0.944 0.446
REALMTerrestrial -0.899 0.424 0.848
abs(temptrend):REALMMarine 0.447 -0.945 -0.455 -0.401
abs(temptrend):REALMTerrestrial 0.428 -0.906 -0.404 -0.473 0.856
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.75457482 -0.22483445 -0.02254226 0.23615730 5.73488343
Number of Observations: 36005
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
257 36005
colors <- brewer.pal(3, 'Dark2')
# make table of coefficients
coefs1 <- as.data.frame(summary(modonlyTtrendrem0)$tTable)
coefs2 <- as.data.frame(summary(modonlyTtrendJbetarem0)$tTable)
coefs3 <- as.data.frame(summary(modonlyTtrendHornrem0)$tTable)
coefs1$mod <- 'Jtu'
coefs2$mod <- 'Jbeta'
coefs3$mod <- 'Horn'
rows1 <- which(grepl('temptrend', rownames(coefs1))) # extract temperature effect
cols <- c('Value', 'Std.Error', 'mod')
allcoefs <- rbind(coefs1[rows1, cols], coefs2[rows1, cols], coefs3[rows1, cols])
allcoefs$Value[grepl('REALMMarine', rownames(allcoefs))] <-
allcoefs$Value[grepl('REALMMarine', rownames(allcoefs))] +
allcoefs$Value[!grepl('REALM', rownames(allcoefs))] # add intercept to marine effects
allcoefs$Value[grepl('REALMTerrestrial', rownames(allcoefs))] <-
allcoefs$Value[grepl('REALMTerrestrial', rownames(allcoefs))] +
allcoefs$Value[!grepl('REALM', rownames(allcoefs))] # add intercept to terrestrial effects
allcoefs$lCI <- allcoefs$Value - allcoefs$Std.Error # lower confidence interval
allcoefs$uCI <- allcoefs$Value + allcoefs$Std.Error
allcoefs$y <- c(3, 2, 1) + rep(c(0, -0.1, -0.2), c(3, 3, 3)) # y-values
allcoefs$col <- c(rep(colors[1], 3), rep(colors[2], 3), rep(colors[3], 3))
allcoefs$realm <- rep(c('Freshwater', 'Marine', 'Terrestrial'), 3)
par(las = 1, mai = c(0.8, 2, 0.1, 0.1))
plot(0,0, col = 'white', xlim=c(-0.1, 0.85), ylim = c(0.5,3),
yaxt='n', xlab = 'Turnover per |°C/yr|', ylab ='')
axis(2, at = 3:1, labels = c('Freshwater', 'Marine', 'Terrestrial'), cex.axis = 0.7)
abline(v = 0, col = 'grey')
for(i in 1:nrow(allcoefs)){
with(allcoefs[i, ], points(Value, y, pch = 16, col = col))
with(allcoefs[i, ], lines(x = c(lCI, uCI), y = c(y, y), col = col))
}
legend('bottomright', col = colors, lwd = 1, pch = 16,
legend = c('Jaccard turnover', 'Jaccard total', 'Horn-Morisita',
'Jaccard turnover rem0', 'Jaccard total rem0', 'Horn-Morisita rem0'))
Violin plots
# on macbook: fig.width=3, fig.height=2.375, fig.retina=3, out.width=3, out.height=2.375
# on external monitor: fig.width=6, fig.height=4.5
trends[temptrend <= -0.7, temptrendtext := 'Cooling']
trends[abs(temptrend) <= 0.05, temptrendtext := 'Stable']
trends[temptrend >= 0.7, temptrendtext := 'Warming']
trends[abs(rarefyID_y) < 35, latzone := 'Subtropics']
trends[abs(rarefyID_y) >= 35 & abs(rarefyID_x) < 66.56339, latzone := 'Temperate']
trends[abs(rarefyID_y) >= 66.56339, latzone := 'Polar']
p1 <- ggplot(trends[!is.na(temptrendtext), ], aes(temptrendtext, Horntrendrem0)) +
geom_violin(draw_quantiles = c(0.25, 0.5, 0.75), fill = 'grey') +
labs(x = '', y = 'Turnover', tag = 'A', title = 'Rate of temperature change') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=8),
axis.title=element_text(size=10))
p2 <- ggplot(trends[abs(temptrend) >= 0.1 & !is.na(latzone), ], aes(latzone, Horntrendrem0)) +
geom_violin(draw_quantiles = c(0.25, 0.5, 0.75), fill = 'grey') +
labs(x = '', y = '', tag = 'C', title = 'Warming regions') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=7),
axis.title=element_text(size=10))
grid.arrange(p1, p2, ncol = 2)
Try static covariates plus interactions of abs temperature trend with each covariate:
Except for thermal bias: interact with temperature trend (not abs)
Bowler has lower AIC.
i1 <- trends[, complete.cases(Jtutrendrem0, REALM, tempave_metab.sc, seas.sc, microclim.sc,
temptrend_abs.sc, mass.sc, speed.sc,
consumerfrac.sc, nspp.sc, thermal_bias.sc, npp.sc,
veg.sc, duration.sc, human_bowler.sc)]
i2 <- trends[, complete.cases(Jbetatrendrem0, REALM, tempave_metab.sc, seas.sc, microclim.sc,
temptrend_abs.sc, mass.sc, speed.sc,
consumerfrac.sc, nspp.sc, thermal_bias.sc, npp.sc,
veg.sc, duration.sc, human_bowler.sc)]
i3 <- trends[, complete.cases(Horntrendrem0, REALM, tempave_metab.sc, seas.sc, microclim.sc,
temptrend_abs.sc, mass.sc, speed.sc,
consumerfrac.sc, nspp.sc, thermal_bias.sc, npp.sc,
veg.sc, duration.sc, human_bowler.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
# full models
if(file.exists('temp/modTfullJturem0.rds')){
modTfullJturem0 <- readRDS('temp/modTfullJturem0.rds')
} else {
modTfullJturem0 <- lme(Jtutrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*duration.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i2,], method = 'REML')
saveRDS(modTfullJturem0, file = 'temp/modTfullJturem0.rds')
}
if(file.exists('temp/modTfullJbetarem0.rds')){
modTfullJbetarem0 <- readRDS('temp/modTfullJbetarem0.rds')
} else {
modTfullJbetarem0 <- lme(Jbetatrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*duration.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i2,], method = 'REML')
saveRDS(modTfullJbetarem0, file = 'temp/modTfullJbetarem0.rds')
}
if(file.exists('temp/modTfullHornrem0.rds')){
modTfullHornrem0 <- readRDS('temp/modTfullHornrem0.rds')
} else {
modTfullHornrem0 <- lme(Horntrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*duration.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i3,], method = 'REML')
saveRDS(modTfullHornrem0, file = 'temp/modTfullHornrem0.rds')
}
summary(modTfullJturem0)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.009402743 (Intr)
temptrend_abs.sc 0.024575808 -0.966
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.01091239 2.006389
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.129145
Fixed effects: Jtutrendrem0 ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * duration.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv_. ses.sc mcrcl. mss.sc
temptrend_abs.sc -0.797
REALMMarine -0.955 0.757
REALMTerrestrial -0.683 0.574 0.634
tsign1 -0.095 0.063 0.007 0.012
tempave_metab.sc 0.061 -0.037 -0.053 -0.242 0.074
seas.sc -0.150 0.143 0.202 -0.097 -0.070 0.138
microclim.sc -0.068 0.047 0.077 0.006 0.015 -0.157 0.097
mass.sc 0.061 -0.042 -0.036 -0.038 -0.019 0.100 0.127 -0.001
speed.sc 0.107 -0.093 -0.057 -0.084 -0.073 -0.194 -0.055 0.070 -0.437
consumerfrac.sc -0.028 0.022 0.017 0.133 0.014 -0.135 -0.055 0.017 0.016
nspp.sc 0.020 0.000 -0.074 -0.066 0.049 -0.154 -0.037 -0.113 -0.010
npp.sc 0.041 -0.044 -0.061 0.054 0.041 0.037 -0.136 -0.187 -0.027
veg.sc -0.578 0.387 0.599 0.024 -0.006 0.007 0.080 -0.010 0.021
duration.sc -0.037 0.008 0.032 0.016 -0.160 0.085 -0.006 -0.016 -0.057
temptrend_abs.sc:REALMMarine 0.764 -0.951 -0.804 -0.534 -0.014 0.030 -0.184 -0.056 0.020
temptrend_abs.sc:REALMTerrestrial 0.542 -0.693 -0.499 -0.820 -0.018 0.182 0.078 0.024 0.033
temptrend_abs.sc:tsign1 0.067 -0.140 -0.022 -0.014 -0.507 -0.056 0.012 -0.006 -0.005
temptrend_abs.sc:tempave_metab.sc -0.037 0.042 0.028 0.171 -0.058 -0.788 -0.106 0.091 -0.066
temptrend_abs.sc:seas.sc 0.145 -0.158 -0.183 0.095 0.053 -0.100 -0.777 -0.099 -0.081
temptrend_abs.sc:microclim.sc 0.038 -0.062 -0.047 0.020 -0.014 0.088 -0.068 -0.760 0.028
temptrend_abs.sc:mass.sc -0.040 0.048 0.010 0.020 -0.002 -0.086 -0.066 0.019 -0.701
temptrend_abs.sc:speed.sc -0.084 0.104 0.040 0.073 0.069 0.167 0.031 -0.041 0.266
temptrend_abs.sc:consumerfrac.sc 0.030 -0.037 -0.018 -0.117 -0.007 0.105 0.038 0.009 0.006
temptrend_abs.sc:nspp.sc 0.009 0.008 0.038 0.037 -0.033 0.143 0.035 0.069 0.033
tsign-1:thermal_bias.sc 0.061 -0.041 -0.057 -0.046 -0.078 0.132 -0.217 -0.015 -0.043
tsign1:thermal_bias.sc 0.095 -0.074 -0.103 -0.097 0.063 0.223 -0.330 -0.100 -0.043
temptrend_abs.sc:npp.sc -0.039 0.065 0.059 -0.051 -0.028 -0.007 0.116 0.168 -0.004
temptrend_abs.sc:veg.sc 0.411 -0.507 -0.431 0.022 -0.008 -0.018 -0.115 0.003 -0.018
spd.sc cnsmr. nspp.s npp.sc veg.sc drtn.s t_.:REALMM t_.:REALMT
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc -0.144
nspp.sc 0.184 0.094
npp.sc 0.125 -0.045 -0.188
veg.sc -0.019 -0.010 0.024 -0.178
duration.sc -0.009 0.005 -0.252 0.062 -0.012
temptrend_abs.sc:REALMMarine 0.047 -0.015 0.046 0.064 -0.406 -0.018
temptrend_abs.sc:REALMTerrestrial 0.068 -0.104 0.025 -0.047 0.019 -0.005 0.639
temptrend_abs.sc:tsign1 0.041 -0.007 -0.029 -0.038 -0.018 0.031 0.044 0.011
temptrend_abs.sc:tempave_metab.sc 0.134 0.116 0.154 -0.031 -0.012 -0.031 -0.027 -0.228
temptrend_abs.sc:seas.sc 0.032 0.029 0.038 0.123 -0.109 -0.027 0.207 -0.162
temptrend_abs.sc:microclim.sc -0.055 0.002 0.074 0.183 0.006 0.011 0.077 -0.051
temptrend_abs.sc:mass.sc 0.315 0.008 0.031 -0.007 -0.007 0.044 -0.014 -0.004
temptrend_abs.sc:speed.sc -0.717 0.085 -0.165 -0.064 -0.006 0.001 -0.055 -0.094
temptrend_abs.sc:consumerfrac.sc 0.120 -0.773 -0.069 0.022 0.005 -0.035 0.021 0.127
temptrend_abs.sc:nspp.sc -0.159 -0.046 -0.749 0.118 -0.037 0.195 -0.070 -0.068
tsign-1:thermal_bias.sc -0.006 -0.001 -0.035 0.001 -0.012 0.083 0.050 0.034
tsign1:thermal_bias.sc -0.009 -0.024 -0.044 -0.057 0.000 0.084 0.073 0.084
temptrend_abs.sc:npp.sc -0.064 0.004 0.113 -0.741 0.143 -0.043 -0.103 0.085
temptrend_abs.sc:veg.sc 0.010 0.011 -0.024 0.173 -0.733 0.003 0.537 -0.033
tm_.:1 tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc 0.052
temptrend_abs.sc:seas.sc -0.021 0.109
temptrend_abs.sc:microclim.sc 0.020 -0.040 0.113
temptrend_abs.sc:mass.sc 0.001 0.168 0.052 -0.043
temptrend_abs.sc:speed.sc -0.035 -0.331 -0.003 0.043
temptrend_abs.sc:consumerfrac.sc 0.032 -0.124 -0.063 -0.027
temptrend_abs.sc:nspp.sc 0.029 -0.138 -0.040 -0.043
tsign-1:thermal_bias.sc -0.042 -0.114 0.159 0.007
tsign1:thermal_bias.sc 0.001 -0.216 0.205 0.042
temptrend_abs.sc:npp.sc 0.003 0.030 -0.182 -0.312
temptrend_abs.sc:veg.sc 0.052 0.004 0.149 0.028
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:c.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc -0.475
temptrend_abs.sc:consumerfrac.sc -0.043 -0.120
temptrend_abs.sc:nspp.sc 0.003 0.183 0.085
tsign-1:thermal_bias.sc 0.021 0.018 -0.005
tsign1:thermal_bias.sc 0.007 0.030 0.020
temptrend_abs.sc:npp.sc 0.039 0.037 -0.017
temptrend_abs.sc:veg.sc 0.004 0.000 -0.011
tmptrnd_bs.sc:ns. t-1:_. ts1:_. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc 0.018
tsign1:thermal_bias.sc 0.032 0.357
temptrend_abs.sc:npp.sc -0.114 -0.002 0.055
temptrend_abs.sc:veg.sc 0.017 0.020 -0.012 -0.250
tmptrnd_bs.sc:v. tmptrnd_bs.sc:d. h_.:REALM2T h_.:REALM2M t_.:-1
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc
t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc
[ reached getOption("max.print") -- omitted 7 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.64180587 -0.23617979 -0.02235224 0.26661608 5.42260805
Number of Observations: 36017
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
231 36017
summary(modTfullJbetarem0)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.00722145 (Intr)
temptrend_abs.sc 0.01729128 -0.058
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.003744118 0.9597427
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.892596
Fixed effects: Jbetatrendrem0 ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * duration.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv_. ses.sc mcrcl. mss.sc
temptrend_abs.sc -0.573
REALMMarine -0.947 0.551
REALMTerrestrial -0.752 0.385 0.701
tsign1 -0.084 0.047 0.004 0.001
tempave_metab.sc 0.100 -0.026 -0.084 -0.244 0.098
seas.sc -0.131 0.077 0.178 -0.069 -0.074 0.088
microclim.sc -0.078 0.060 0.090 0.022 -0.001 -0.183 0.138
mass.sc 0.095 -0.010 -0.071 -0.043 0.001 0.089 0.091 0.007
speed.sc 0.081 -0.063 -0.041 -0.088 -0.086 -0.110 -0.014 0.039 -0.493
consumerfrac.sc -0.012 0.017 0.010 0.096 -0.022 -0.105 -0.031 0.020 0.012
nspp.sc 0.007 -0.032 -0.062 -0.038 0.049 -0.200 -0.033 -0.135 -0.054
npp.sc 0.025 -0.013 -0.040 0.032 0.066 0.073 -0.077 -0.140 -0.028
veg.sc -0.442 0.365 0.462 0.011 -0.014 -0.003 0.073 -0.003 0.018
duration.sc -0.041 0.009 0.031 -0.003 -0.144 0.129 -0.003 -0.024 -0.042
temptrend_abs.sc:REALMMarine 0.554 -0.951 -0.570 -0.361 -0.009 0.023 -0.099 -0.066 0.000
temptrend_abs.sc:REALMTerrestrial 0.377 -0.740 -0.350 -0.552 0.001 0.148 0.116 0.024 -0.011
temptrend_abs.sc:tsign1 0.055 -0.127 -0.022 0.002 -0.442 -0.055 0.003 -0.006 -0.004
temptrend_abs.sc:tempave_metab.sc -0.001 0.056 -0.009 0.132 -0.104 -0.539 -0.130 0.018 -0.066
temptrend_abs.sc:seas.sc 0.079 -0.108 -0.106 0.104 0.050 -0.090 -0.726 -0.122 -0.063
temptrend_abs.sc:microclim.sc 0.053 -0.078 -0.061 0.002 -0.009 0.112 -0.091 -0.780 0.012
temptrend_abs.sc:mass.sc -0.018 0.040 0.012 -0.009 -0.004 -0.077 -0.056 0.024 -0.577
temptrend_abs.sc:speed.sc -0.070 0.093 0.057 0.080 0.074 0.129 0.055 -0.019 0.240
temptrend_abs.sc:consumerfrac.sc 0.010 -0.032 -0.009 -0.076 0.016 0.077 0.031 0.012 0.003
temptrend_abs.sc:nspp.sc -0.023 0.016 0.048 0.045 -0.026 0.119 0.035 0.070 0.011
tsign-1:thermal_bias.sc 0.066 -0.022 -0.062 -0.049 -0.068 0.135 -0.240 -0.022 -0.040
tsign1:thermal_bias.sc 0.122 -0.044 -0.126 -0.104 0.066 0.252 -0.437 -0.133 -0.017
temptrend_abs.sc:npp.sc -0.002 0.057 0.015 -0.054 -0.040 -0.016 0.065 0.155 0.001
temptrend_abs.sc:veg.sc 0.351 -0.443 -0.367 0.020 -0.001 -0.016 -0.088 -0.009 -0.010
spd.sc cnsmr. nspp.s npp.sc veg.sc drtn.s t_.:REALMM t_.:REALMT
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc -0.089
nspp.sc 0.212 0.100
npp.sc 0.163 -0.052 -0.198
veg.sc -0.024 -0.018 0.023 -0.204
duration.sc -0.033 0.012 -0.240 0.077 -0.012
temptrend_abs.sc:REALMMarine 0.039 -0.010 0.063 0.038 -0.386 -0.008
temptrend_abs.sc:REALMTerrestrial 0.076 -0.073 0.049 -0.055 0.021 0.007 0.690
temptrend_abs.sc:tsign1 0.033 0.004 -0.025 -0.056 -0.025 0.020 0.040 0.006
temptrend_abs.sc:tempave_metab.sc 0.142 0.085 0.123 -0.020 -0.009 -0.054 -0.041 -0.239
temptrend_abs.sc:seas.sc 0.014 0.028 0.045 0.090 -0.086 -0.036 0.149 -0.173
temptrend_abs.sc:microclim.sc -0.029 -0.008 0.083 0.167 -0.009 0.011 0.090 -0.058
temptrend_abs.sc:mass.sc 0.282 0.015 0.014 -0.015 -0.010 0.055 -0.003 0.016
temptrend_abs.sc:speed.sc -0.601 0.071 -0.148 -0.068 0.004 0.014 -0.042 -0.098
temptrend_abs.sc:consumerfrac.sc 0.080 -0.717 -0.065 0.026 0.009 -0.023 0.019 0.109
temptrend_abs.sc:nspp.sc -0.153 -0.045 -0.640 0.108 -0.028 0.167 -0.078 -0.068
tsign-1:thermal_bias.sc 0.027 0.006 -0.048 0.004 -0.012 0.085 0.029 0.020
tsign1:thermal_bias.sc 0.026 -0.030 -0.081 -0.042 0.000 0.105 0.035 0.057
temptrend_abs.sc:npp.sc -0.085 0.016 0.109 -0.733 0.163 -0.056 -0.093 0.085
temptrend_abs.sc:veg.sc 0.006 0.013 -0.026 0.181 -0.813 0.012 0.474 -0.031
tm_.:1 tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc 0.047
temptrend_abs.sc:seas.sc -0.018 0.080
temptrend_abs.sc:microclim.sc 0.009 0.029 0.157
temptrend_abs.sc:mass.sc 0.009 0.140 0.042 -0.046
temptrend_abs.sc:speed.sc -0.031 -0.308 0.027 0.032
temptrend_abs.sc:consumerfrac.sc 0.018 -0.106 -0.070 -0.031
temptrend_abs.sc:nspp.sc 0.024 -0.134 -0.035 -0.050
tsign-1:thermal_bias.sc -0.046 -0.045 0.153 0.009
tsign1:thermal_bias.sc 0.016 -0.124 0.210 0.051
temptrend_abs.sc:npp.sc 0.025 0.053 -0.193 -0.305
temptrend_abs.sc:veg.sc 0.047 -0.014 0.141 0.056
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:c.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc -0.446
temptrend_abs.sc:consumerfrac.sc -0.050 -0.119
temptrend_abs.sc:nspp.sc -0.002 0.166 0.084
tsign-1:thermal_bias.sc 0.019 -0.008 -0.009
tsign1:thermal_bias.sc 0.013 -0.009 0.019
temptrend_abs.sc:npp.sc 0.047 0.029 -0.021
temptrend_abs.sc:veg.sc 0.005 0.012 -0.016
tmptrnd_bs.sc:ns. t-1:_. ts1:_. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc 0.017
tsign1:thermal_bias.sc 0.025 0.340
temptrend_abs.sc:npp.sc -0.114 0.006 0.081
temptrend_abs.sc:veg.sc 0.013 0.012 -0.026 -0.281
tmptrnd_bs.sc:v. tmptrnd_bs.sc:d. h_.:REALM2T h_.:REALM2M t_.:-1
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc
t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc
[ reached getOption("max.print") -- omitted 7 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.38434700 -0.32179127 -0.03059932 0.31554016 8.33570233
Number of Observations: 36017
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
231 36017
summary(modTfullHornrem0)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.01556817 (Intr)
temptrend_abs.sc 0.02706589 -0.065
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.01880474 2.445174
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.327824
Fixed effects: Horntrendrem0 ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tsign + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * duration.sc + temptrend_abs.sc * human_bowler.sc:REALM2
Correlation:
(Intr) tmpt_. REALMM REALMT tsign1 tmpv_. ses.sc mcrcl. mss.sc
temptrend_abs.sc -0.501
REALMMarine -0.954 0.479
REALMTerrestrial -0.737 0.361 0.685
tsign1 -0.065 0.046 -0.001 0.011
tempave_metab.sc 0.101 -0.030 -0.080 -0.245 0.030
seas.sc -0.109 0.050 0.157 -0.095 -0.088 0.103
microclim.sc -0.067 0.042 0.076 0.017 0.014 -0.185 0.101
mass.sc 0.067 -0.007 -0.044 -0.030 -0.007 0.089 0.096 0.007
speed.sc 0.085 -0.062 -0.039 -0.090 -0.069 -0.078 -0.011 0.059 -0.421
consumerfrac.sc -0.017 0.024 0.010 0.088 0.033 -0.120 -0.052 0.016 -0.014
nspp.sc 0.008 -0.037 -0.051 -0.053 0.052 -0.146 0.006 -0.090 -0.060
npp.sc 0.026 0.001 -0.038 0.058 0.012 0.024 -0.189 -0.215 -0.036
veg.sc -0.518 0.276 0.536 0.028 -0.012 0.007 0.086 0.005 0.013
duration.sc -0.021 0.012 0.029 0.021 -0.149 0.077 -0.030 -0.022 -0.027
temptrend_abs.sc:REALMMarine 0.485 -0.949 -0.497 -0.337 -0.014 0.029 -0.069 -0.049 -0.004
temptrend_abs.sc:REALMTerrestrial 0.322 -0.727 -0.296 -0.510 -0.003 0.161 0.123 0.019 -0.017
temptrend_abs.sc:tsign1 0.041 -0.112 -0.010 0.003 -0.490 -0.038 0.007 -0.009 0.005
temptrend_abs.sc:tempave_metab.sc -0.008 0.041 -0.001 0.142 -0.063 -0.500 -0.094 0.047 -0.052
temptrend_abs.sc:seas.sc 0.059 -0.087 -0.081 0.111 0.052 -0.064 -0.641 -0.093 -0.060
temptrend_abs.sc:microclim.sc 0.029 -0.045 -0.034 0.002 -0.024 0.103 -0.051 -0.705 0.016
temptrend_abs.sc:mass.sc -0.010 0.023 0.005 -0.014 0.012 -0.062 -0.054 0.020 -0.580
temptrend_abs.sc:speed.sc -0.047 0.100 0.033 0.075 0.048 0.099 0.041 -0.036 0.222
temptrend_abs.sc:consumerfrac.sc 0.013 -0.035 -0.012 -0.064 -0.016 0.087 0.031 0.014 0.019
temptrend_abs.sc:nspp.sc -0.025 0.029 0.040 0.054 -0.019 0.077 0.011 0.047 0.009
tsign-1:thermal_bias.sc 0.060 -0.021 -0.056 -0.059 -0.088 0.204 -0.213 -0.040 -0.045
tsign1:thermal_bias.sc 0.103 -0.035 -0.105 -0.109 0.070 0.342 -0.321 -0.140 -0.016
temptrend_abs.sc:npp.sc 0.010 0.023 -0.006 -0.055 -0.005 -0.012 0.086 0.158 -0.004
temptrend_abs.sc:veg.sc 0.306 -0.426 -0.317 0.025 -0.011 -0.024 -0.102 0.009 -0.013
spd.sc cnsmr. nspp.s npp.sc veg.sc drtn.s t_.:REALMM t_.:REALMT
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc -0.086
nspp.sc 0.179 0.094
npp.sc 0.120 -0.037 -0.198
veg.sc -0.005 -0.003 0.021 -0.163
duration.sc 0.011 0.008 -0.241 0.053 -0.006
temptrend_abs.sc:REALMMarine 0.035 -0.018 0.063 0.018 -0.292 -0.016
temptrend_abs.sc:REALMTerrestrial 0.082 -0.062 0.062 -0.057 0.030 -0.014 0.674
temptrend_abs.sc:tsign1 0.031 -0.012 -0.021 -0.035 -0.008 0.033 0.035 0.006
temptrend_abs.sc:tempave_metab.sc 0.118 0.079 0.088 -0.044 -0.013 -0.016 -0.027 -0.273
temptrend_abs.sc:seas.sc 0.013 0.019 0.025 0.125 -0.089 -0.016 0.123 -0.209
temptrend_abs.sc:microclim.sc -0.040 -0.007 0.051 0.172 0.014 0.011 0.057 -0.060
temptrend_abs.sc:mass.sc 0.245 0.026 0.011 -0.011 -0.009 0.047 0.012 0.032
temptrend_abs.sc:speed.sc -0.581 0.071 -0.127 -0.042 -0.015 -0.008 -0.043 -0.109
temptrend_abs.sc:consumerfrac.sc 0.074 -0.719 -0.063 0.013 -0.001 -0.021 0.023 0.094
temptrend_abs.sc:nspp.sc -0.134 -0.044 -0.615 0.100 -0.021 0.150 -0.081 -0.080
tsign-1:thermal_bias.sc 0.004 -0.007 -0.044 0.008 -0.005 0.073 0.027 0.027
tsign1:thermal_bias.sc -0.022 -0.017 -0.065 -0.057 -0.007 0.085 0.028 0.053
temptrend_abs.sc:npp.sc -0.058 0.005 0.098 -0.652 0.098 -0.036 -0.052 0.088
temptrend_abs.sc:veg.sc 0.000 0.003 -0.021 0.158 -0.620 0.002 0.456 -0.060
tm_.:1 tm_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc 0.036
temptrend_abs.sc:seas.sc -0.027 0.073
temptrend_abs.sc:microclim.sc 0.005 0.021 0.115
temptrend_abs.sc:mass.sc -0.003 0.103 0.050 -0.051
temptrend_abs.sc:speed.sc -0.022 -0.285 0.012 0.040
temptrend_abs.sc:consumerfrac.sc 0.032 -0.099 -0.060 -0.037
temptrend_abs.sc:nspp.sc 0.012 -0.121 -0.028 -0.020
tsign-1:thermal_bias.sc -0.029 -0.061 0.132 0.022
tsign1:thermal_bias.sc 0.009 -0.115 0.148 0.048
temptrend_abs.sc:npp.sc 0.004 0.077 -0.208 -0.321
temptrend_abs.sc:veg.sc 0.054 0.006 0.173 0.006
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:c.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc -0.394
temptrend_abs.sc:consumerfrac.sc -0.060 -0.116
temptrend_abs.sc:nspp.sc 0.007 0.159 0.088
tsign-1:thermal_bias.sc 0.020 0.003 0.002
tsign1:thermal_bias.sc 0.019 0.011 0.014
temptrend_abs.sc:npp.sc 0.052 0.013 0.000
temptrend_abs.sc:veg.sc 0.007 0.023 -0.006
tmptrnd_bs.sc:ns. t-1:_. ts1:_. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc 0.014
tsign1:thermal_bias.sc 0.022 0.393
temptrend_abs.sc:npp.sc -0.100 -0.016 0.045
temptrend_abs.sc:veg.sc 0.012 0.015 -0.016 -0.242
tmptrnd_bs.sc:v. tmptrnd_bs.sc:d. h_.:REALM2T h_.:REALM2M t_.:-1
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc
t_.:1: t_.:_.:REALM2T
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc
[ reached getOption("max.print") -- omitted 7 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.67542034 -0.23386259 -0.02454167 0.23164547 5.75602618
Number of Observations: 35327
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
200 35327
coefs1 <- summary(modTfullJturem0)$tTable
coefs2 <- summary(modTfullJbetarem0)$tTable
coefs3 <- summary(modTfullHornrem0)$tTable
varstoplot <- unique(c(rownames(coefs1), rownames(coefs2), rownames(coefs3)))
varstoplot <- varstoplot[which(!grepl('Intercept', varstoplot) | grepl(':', varstoplot))] # vars to plot
rows1_1 <- which(rownames(coefs1) %in% varstoplot) # rows in coefs
rows1_2 <- which(rownames(coefs2) %in% varstoplot)
rows1_3 <- which(rownames(coefs3) %in% varstoplot)
xlims <- range(c(coefs1[rows1_1,1] - coefs1[rows1_1,2], coefs1[rows1_1,1] + coefs1[rows1_1,2],
coefs2[rows1_2,1] - coefs2[rows1_2,2], coefs2[rows1_2,1] + coefs2[rows1_2,2],
coefs3[rows1_3,1] - coefs3[rows1_3,2], coefs3[rows1_3,1] + coefs3[rows1_3,2]))
cols <- brewer.pal(3, 'Dark2') # for Jtu, Jbeta and Horn models
pchs <- c(16, 16, 16)
offs <- c(0.1, 0, -0.1) # offset vertically for each model
par(las = 1, mai = c(0.5, 4, 0.1, 0.1))
plot(0,0, col = 'white', xlim = xlims, ylim = c(1,length(varstoplot)), yaxt='n', xlab = '', ylab ='')
axis(2, at = length(varstoplot):1, labels = varstoplot, cex.axis = 0.7)
abline(v = 0, col = 'grey', lty = 2)
abline(h = 1:length(varstoplot), col = 'grey', lty = 3)
for(i in 1:length(varstoplot)){
if(varstoplot[i] %in% rownames(coefs1)){
x = coefs1[rownames(coefs1) == varstoplot[i], 1]
se = coefs1[rownames(coefs1) == varstoplot[i], 2]
points(x, length(varstoplot) + 1 - i + offs[1], pch = pchs[1], col = cols[1])
lines(x = c(x-se, x+se), y = c(length(varstoplot) + 1 - i + offs[1], length(varstoplot) + 1 - i + offs[1]), col = cols[1])
}
if(varstoplot[i] %in% rownames(coefs2)){
x = coefs2[rownames(coefs2) == varstoplot[i], 1]
se = coefs2[rownames(coefs2) == varstoplot[i], 2]
points(x, length(varstoplot) + 1 - i + offs[2], pch = pchs[2], col = cols[2])
lines(x = c(x-se, x+se), y = c(length(varstoplot) + 1 - i + offs[2], length(varstoplot) + 1 - i + offs[2]), col = cols[2])
}
if(varstoplot[i] %in% rownames(coefs3)){
x = coefs3[rownames(coefs3) == varstoplot[i], 1]
se = coefs3[rownames(coefs3) == varstoplot[i], 2]
points(x, length(varstoplot) + 1 - i + offs[3], pch = pchs[3], col = cols[3])
lines(x = c(x-se, x+se), y = c(length(varstoplot) + 1 - i + offs[3], length(varstoplot) + 1 - i + offs[3]), col = cols[3])
}
}
legend('topleft', col = cols, pch = 16, lwd = 1, legend = c('Jtu', 'Jbeta', 'Horn'), cex = 0.5)
## NEED TO ALIGN THE INTS DF AGAIN
# set up the interactions to plot
ints <- data.frame(vars = c('tsign', 'tempave_metab', 'seas', 'microclim', 'mass', 'speed',
'consumerfrac', 'nspp', 'thermal_bias', 'npp', 'veg', 'duration',
'human_bowler', 'human_bowler'),
min = c(1, -10, 0.1, 0, 0, 0, 0, 0.3, -10, 1.9, 0, 0.5, 0, 0),
max = c(2, 30, 16, 6, 8, 2, 1, 2.6, 10, 3.7, 1, 2, 9, 9),
log = c(F, F, F, F, T, T, F, T, F, T, F, T, F, F),
len = c(2, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100),
discrete = c(T, F, F, F, F, F, F, F, F, F, F, F, F, F),
REALM = c(rep('Freshwater', 13), 'Marine'),
REALM2 = c(rep('TerrFresh', 13), 'Marine'),
stringsAsFactors = FALSE)
basetab <- data.frame(tempave.sc = 0, tempave_metab.sc = 0,
seas.sc = 0, microclim.sc = 0, mass.sc = 0,
speed.sc = 0, lifespan.sc = 0, endothermfrac.sc = 0,
nspp.sc = 0, thermal_bias.sc = 0, npp.sc = 0, human_bowler.sc = 0, veg.sc = 0,
consumerfrac.sc = 0, duration.sc = 0,
nyrBT = 20, STUDY_ID = 127L, rarefyID = '127_514668')
# make the data frames for each interaction to plot
for(j in 1:nrow(ints)){
# set up a grid of temperature trends and the interacting variable
if(ints$log[j]) intvars <- list(temptrend = seq(-1.5, 1.5, length.out = 100),
new = 10^seq(ints$min[j], ints$max[j], length.out = ints$len[j]),
var = ints$vars[j])
if(!ints$log[j]) intvars <- list(temptrend = seq(-1.5, 1.5, length.out = 100),
new = seq(ints$min[j], ints$max[j], length.out = ints$len[j]),
var = ints$vars[j])
names(intvars) <- c('temptrend', ints$vars[j], 'var')
thisdat <- expand.grid(intvars)
# scale the interacting variable
cent <- attr(trends[[paste0(ints$var[j], '.sc')]], 'scaled:center')
scl <- attr(trends[[paste0(ints$var[j], '.sc')]], 'scaled:scale')
if(!is.null(cent) & !is.null(scl)){
if(ints$log[j]) thisdat[[paste0(ints$var[j], '.sc')]] <- (log(thisdat[[ints$var[j]]]) - cent)/scl
if(!ints$log[j]) thisdat[[paste0(ints$var[j], '.sc')]] <- (thisdat[[ints$var[j]]] - cent)/scl
}
# merge with the rest of the columns
if(ints$var[j] != 'tsign') colnamestouse <- setdiff(colnames(basetab), paste0(ints$var[j], '.sc'))
if(ints$var[j] == 'tsign') colnamestouse <- setdiff(colnames(basetab), ints$var[j])
thisdat <- cbind(thisdat, basetab[, colnamestouse])
# add realm
thisdat$REALM <- ints$REALM[j]
thisdat$REALM2 <- ints$REALM2[j]
# merge with the previous iterations
if(j == 1) newdat <- thisdat
if(j > 1){
colstoadd <- setdiff(colnames(thisdat), colnames(newdat))
for(toadd in colstoadd){
newdat[[toadd]] <- NA
}
colstoadd2 <- setdiff(colnames(newdat), colnames(thisdat))
for(toadd in colstoadd2){
thisdat[[toadd]] <- NA
}
newdat <- rbind(newdat, thisdat)
}
}
# character so that new levels can be added
newdat$REALM <- as.character(newdat$REALM)
newdat$REALM2 <- as.character(newdat$REALM2)
# add extra rows so that all factor levels are represented (for predict.lme to work)
newdat <- rbind(newdat[1:4, ], newdat)
newdat$REALM[1:4] <- c('Marine', 'Marine', 'Terrestrial', 'Terrestrial')
newdat$REALM2[1:4] <- c('Marine', 'Marine', 'TerrFresh', 'TerrFresh')
newdat$temptrend[1:4] <- c(-1, 1, -1, 1)
# trim to at least some temperature change (so that tsign is -1 or 1)
newdat <- newdat[newdat$temptrend != 0,]
# scale the temperature vars
newdat$temptrend.sc <- newdat$temptrend/attr(trends$temptrend.sc, 'scaled:scale')
newdat$temptrend_abs <- abs(newdat$temptrend)
newdat$temptrend_abs.sc <- (newdat$temptrend_abs)/attr(trends$temptrend_abs.sc, 'scaled:scale')
newdat$tsign <- factor(sign(newdat$temptrend))
# make predictions
newdat$preds <- predict(object = modTfullrem0, newdata = newdat, level = 0)
#remove the extra rows
newdat <- newdat[5:nrow(newdat), ]
# prep the plots
intplots <- vector('list', nrow(ints))
for(j in 1:length(intplots)){
subs <- newdat$var == ints$vars[j] & newdat$temptrend > 0 # select warming side
xvar <- 'temptrend_abs'
title <- ints$vars[j]
if(ints$vars[j] %in% c('tsign')){
subs <- newdat$var == ints$vars[j]
}
if(ints$vars[j] %in% c('thermal_bias')){
subs <- newdat$var == ints$vars[j]
xvar <- 'temptrend'
}
if(ints$vars[j] %in% c('human_bowler')){
subs <- newdat$var == ints$vars[j] & newdat$temptrend > 0 & newdat$REALM2 == ints$REALM2[j]
title <- paste0('human:', ints$REALM2[j])
}
thisplot <- ggplot(newdat[subs, ],
aes_string(x = xvar, y = 'preds',
group = ints$vars[j],
color = ints$vars[j])) +
geom_line() +
coord_cartesian(ylim = c(-0.6, 0.6)) +
theme(plot.margin = unit(c(0.5,0,0.5,0), 'cm')) +
labs(title = title)
if(ints$log[j] & !ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_distiller(palette = "YlGnBu", trans = 'log')
}
if(!ints$log[j] & !ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_distiller(palette = "YlGnBu", trans = 'identity')
}
if(ints$discrete[j]){
intplots[[j]] <- thisplot + scale_color_brewer(palette = "Dark2")
}
}
#grid.arrange(grobs = intplots, '+', theme(plot.margin = unit(c(0,0,0,0), 'cm'))), ncol=2)
#do.call('grid.arrange', c(intplots, ncol = 2))
grid.arrange(grobs = intplots, ncol = 3)
# write out the interactions
write.csv(newdat, file = 'temp/interactions.csv')
resids <- resid(modTfull1)
preds <- getData(modTfull1)
col = '#00000033'
cex = 0.5
par(mfrow = c(5,4))
boxplot(resids ~ preds$REALM, cex = cex, col = col)
plot(preds$temptrend_abs.sc, resids, cex = cex, col = col)
plot(preds$tsign, resids, cex = cex, col = col)
plot(preds$tempave.sc, resids, cex = cex, col = col)
plot(preds$tempave_metab.sc, resids, cex = cex, col = col)
plot(preds$seas.sc, resids, cex = cex, col = col)
plot(preds$microclim.sc, resids, cex = cex, col = col)
plot(preds$mass.sc, resids, cex = cex, col = col)
plot(preds$speed.sc, resids, cex = cex, col = col)
plot(preds$lifespan.sc, resids, cex = cex, col = col)
plot(preds$consumerfrac.sc, resids, cex = cex, col = col)
plot(preds$endothermfrac.sc, resids, cex = cex, col = col)
plot(preds$nspp.sc, resids, cex = cex, col = col)
plot(preds$thermal_bias.sc, resids, cex = cex, col = col)
plot(preds$npp.sc, resids, cex = cex, col = col)
plot(preds$veg.sc, resids, cex = cex, col = col)
plot(preds$human_bowler.sc, resids, cex = cex, col = col)
tryCatch({
modTdrops[[j+2]] <- lme(formula(paste0('Jtutrendrem0 ~ ', paste(terms[-j], collapse = ' + '))),
random = randef, weights = varef, data = trends[i,], method = 'ML')
}, error = function(e){
print('going to optim (Jtu)')
tryCatch({
modTdrops[[j+2]] <- lme(formula(paste0('Jtutrendrem0 ~ ', paste(terms[-j], collapse = ' + '))),
random = randef, weights = varef, data = trends[i,], method = 'ML',
control = lmeControl(opt = 'optim'))
}, error = function(e){
print('going to more iters (Jtu)')
tryCatch({
modTdrops[[j+2]] <- lme(formula(paste0('Jtutrendrem0 ~ ', paste(terms[-j], collapse = ' + '))),
random = randef, weights = varef, data = trends[i,], method = 'ML',
control = lmeControl(maxIter = 100, msMaxIter = 100, niterEM = 50, msMaxEval = 500))
}, error= function(e){
print('giving up on this one')
modTdrops[[j+2]] <- NA
})
})
})
[1] "going to optim (Jtu)"
[1] "going to more iters (Jtu)"
# transform for a plot
aicsfromfulllong <- reshape(aicsfromfull, direction = 'long',
varying = c('dAIC_Jtu', 'dAIC_Jbeta', 'dAIC_Horn'),
v.names = 'dAIC',
idvar = 'mod',
timevar = 'type',
times = c('Jtu', 'Jbeta', 'Horn'))
trans = function(x) sign(x)*sqrt(abs(x))
aicsfromfulllong$dAIC_tr <- trans(aicsfromfulllong$dAIC)
# plot
xlims <- range(aicsfromfulllong$dAIC_tr, na.rm = TRUE)
xticks <- c(-10, 0, 10, 100, 1000, 10000)
par(mai = c(0.5, 3, 0.1, 0.1))
with(aicsfromfulllong[aicsfromfulllong$type == 'Jtu',], plot(dAIC_tr, nrow(aicsfromfull):1,
col = 'light grey', xlim = xlims, yaxt = 'n', ylab = '', xaxt = 'n'))
with(aicsfromfulllong[aicsfromfulllong$type == 'Jbeta',], points(dAIC_tr, nrow(aicsfromfull):1 - 0.1, col = 'dark grey'))
with(aicsfromfulllong[aicsfromfulllong$type == 'Horn',], points(dAIC_tr, nrow(aicsfromfull):1 - 0.2, col = 'black'))
axis(2, at = nrow(aicsfromfull):1, labels = aicsfromfull$mod, las = 1, cex.axis = 0.7)
axis(1, at = trans(xticks), labels = xticks, cex.axis = 0.5)
abline(v = 0, lty =2, col = 'grey')
Light grey is for Jaccard turnover, dark grey is for Jaccard total, black is for Morisita-Horn. Clear that removing temperature trend makes the model quite a bit worse and has the biggest effect.
This takes a couple days on a laptop to run.
i1 <- trends[, complete.cases(Jtutrendrem0, REALM, tempave_metab.sc, seas.sc, microclim.sc,
temptrend_abs.sc, mass.sc, speed.sc,
consumerfrac.sc, nspp.sc, thermal_bias.sc, npp.sc,
veg.sc, duration.sc, human_bowler.sc)]
i2 <- trends[, complete.cases(Jbetatrendrem0, REALM, tempave_metab.sc, seas.sc, microclim.sc,
temptrend_abs.sc, mass.sc, speed.sc,
consumerfrac.sc, nspp.sc, thermal_bias.sc, npp.sc,
veg.sc, duration.sc, human_bowler.sc)]
i3 <- trends[, complete.cases(Horntrendrem0, REALM, tempave_metab.sc, seas.sc, microclim.sc,
temptrend_abs.sc, mass.sc, speed.sc,
consumerfrac.sc, nspp.sc, thermal_bias.sc, npp.sc,
veg.sc, duration.sc, human_bowler.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
# simplify the full models
if(file.exists('temp/modTsimpJturem0.rds')){
modTsimpJturem0 <- readRDS('temp/modTsimpJturem0.rds')
} else {
modTfullJturem0ML <- lme(Jtutrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*duration.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i1,], method = 'ML',
control = lmeControl(maxIter = 100, msMaxIter = 100, niterEM = 50, msMaxEval = 500))
modTsimpJturem0 <- stepAIC(modTfullJturem0ML, direction = 'backward')
saveRDS(modTsimpJturem0, file = 'temp/modTsimpJturem0.rds')
}
if(file.exists('temp/modTsimpJbetarem0.rds')){
modTsimpJbetarem0 <- readRDS('temp/modTsimpJbetarem0.rds')
} else {
modTfullJbetarem0ML <- lme(Jbetatrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*duration.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i2,], method = 'ML')
modTsimpJbetarem0 <- stepAIC(modTfullJbetarem0ML, direction = 'backward')
saveRDS(modTsimpJbetarem0, file = 'temp/modTsimpJbetarem0.rds')
}
if(file.exists('temp/modTsimpHornrem0.rds')){
modTsimpHornrem0 <- readRDS('temp/modTsimpHornrem0.rds')
} else {
modTfullHornrem0ML <- lme(Horntrendrem0 ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tsign +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend_abs.sc*thermal_bias.sc:tsign +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*veg.sc +
temptrend_abs.sc*duration.sc +
temptrend_abs.sc*human_bowler.sc:REALM2,
random = randef, weights = varef, data = trends[i3,], method = 'ML')
modTsimpHornrem0 <- stepAIC(modTfullHornrem0ML, direction = 'backward')
saveRDS(modTsimpHornrem0, file = 'temp/modTsimpHornrem0.rds')
}
summary(modTsimpJturem0)
summary(modTsimpJbetarem0)
summary(modTsimpHornrem0)
summary(modTfullHornTerr)
Linear mixed-effects model fit by REML
Data: trends[i1, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.009555472 (Intr)
temptrend_abs.sc 0.022365121 0.313
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.004029061 1.695873
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.036154
Fixed effects: Horntrendrem0 ~ temptrend_abs.sc * tsign + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * duration.sc + temptrend_abs.sc * human_bowler.sc
Correlation:
(Intr) tmpt_. tsign1 tmpv_. ses.sc mcrcl. mss.sc spd.sc cnsmr.
temptrend_abs.sc -0.629
tsign1 -0.215 0.019
tempave_metab.sc -0.486 0.307 -0.209
seas.sc -0.258 0.267 -0.078 0.049
microclim.sc -0.182 0.232 0.094 -0.018 0.473
mass.sc 0.515 -0.246 -0.010 -0.141 0.008 0.039
speed.sc 0.102 0.048 -0.033 -0.595 -0.025 -0.031 -0.141
consumerfrac.sc 0.356 -0.340 0.181 0.004 -0.048 0.072 0.424 -0.654
nspp.sc -0.064 0.025 -0.016 -0.061 -0.118 -0.161 -0.012 0.032 0.000
npp.sc -0.044 0.007 0.118 -0.045 0.204 0.149 0.011 0.013 -0.007
veg.sc -0.213 0.262 -0.078 -0.082 -0.069 -0.106 0.001 0.198 -0.160
duration.sc -0.098 0.042 -0.186 0.067 0.069 -0.016 -0.013 -0.051 0.138
human_bowler.sc -0.229 0.250 0.042 0.057 -0.059 0.150 -0.120 0.007 -0.147
temptrend_abs.sc:tsign1 0.169 -0.306 -0.490 0.093 -0.109 -0.195 0.015 0.050 -0.111
temptrend_abs.sc:tempave_metab.sc 0.296 -0.503 0.138 -0.662 -0.039 -0.003 0.002 0.427 -0.032
temptrend_abs.sc:seas.sc 0.219 -0.380 0.028 -0.025 -0.748 -0.378 -0.012 0.008 0.045
temptrend_abs.sc:microclim.sc 0.174 -0.290 -0.097 0.007 -0.367 -0.845 -0.034 0.038 -0.071
temptrend_abs.sc:mass.sc -0.313 0.361 0.005 -0.015 -0.041 -0.038 -0.642 0.280 -0.433
temptrend_abs.sc:speed.sc 0.039 0.012 0.007 0.427 0.048 0.058 0.213 -0.732 0.560
temptrend_abs.sc:consumerfrac.sc -0.283 0.407 -0.096 -0.047 -0.009 -0.066 -0.336 0.552 -0.784
temptrend_abs.sc:nspp.sc 0.025 -0.086 0.006 0.050 0.053 0.060 -0.005 0.003 -0.014
tsign-1:thermal_bias.sc -0.091 -0.062 0.667 -0.179 -0.286 -0.090 0.013 -0.024 0.140
tsign1:thermal_bias.sc 0.212 -0.208 -0.065 -0.033 -0.666 -0.403 0.049 0.039 -0.026
temptrend_abs.sc:npp.sc 0.027 0.023 -0.116 0.050 -0.131 -0.072 -0.023 -0.018 0.004
temptrend_abs.sc:veg.sc 0.225 -0.308 0.055 0.044 0.027 0.048 0.031 -0.133 0.116
temptrend_abs.sc:duration.sc -0.064 0.147 0.020 -0.086 -0.033 0.033 0.001 0.020 -0.059
temptrend_abs.sc:human_bowler.sc 0.242 -0.331 -0.037 -0.055 -0.037 -0.159 0.096 0.004 0.106
temptrend_abs.sc:tsign-1:thermal_bias.sc 0.049 -0.049 -0.379 0.107 0.218 0.025 -0.004 0.036 -0.095
temptrend_abs.sc:tsign1:thermal_bias.sc -0.140 0.284 0.118 -0.001 0.450 0.297 -0.010 -0.009 0.032
nspp.s npp.sc veg.sc drtn.s hmn_b. tm_.:1 tmptrnd_bs.sc:t_.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc -0.064
veg.sc -0.038 -0.553
duration.sc -0.012 -0.020 -0.022
human_bowler.sc 0.019 -0.190 0.287 -0.127
temptrend_abs.sc:tsign1 -0.013 -0.123 0.012 0.122 -0.120
temptrend_abs.sc:tempave_metab.sc 0.065 0.034 0.059 -0.090 -0.025 -0.077
temptrend_abs.sc:seas.sc 0.073 -0.106 0.012 -0.028 -0.077 0.146 0.033
temptrend_abs.sc:microclim.sc 0.090 -0.089 0.054 0.026 -0.139 0.232 0.001
temptrend_abs.sc:mass.sc 0.018 -0.026 0.020 0.031 0.088 0.053 0.063
temptrend_abs.sc:speed.sc -0.016 -0.007 -0.133 0.034 0.004 -0.073 -0.598
temptrend_abs.sc:consumerfrac.sc 0.017 0.007 0.087 -0.118 0.068 0.101 0.017
temptrend_abs.sc:nspp.sc -0.603 0.011 0.028 -0.007 0.055 0.019 -0.015
tsign-1:thermal_bias.sc 0.004 0.115 -0.079 -0.062 0.055 -0.214 0.119
tsign1:thermal_bias.sc -0.028 0.143 -0.091 -0.017 0.084 0.301 0.012
temptrend_abs.sc:npp.sc 0.003 -0.880 0.494 0.021 0.147 0.149 -0.046
temptrend_abs.sc:veg.sc 0.013 0.504 -0.847 0.026 -0.301 -0.005 -0.071
temptrend_abs.sc:duration.sc 0.152 0.001 0.010 -0.250 0.105 -0.223 0.094
temptrend_abs.sc:human_bowler.sc 0.032 0.135 -0.334 0.116 -0.798 0.151 0.051
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.015 -0.268 0.129 0.041 -0.116 0.635 -0.107
temptrend_abs.sc:tsign1:thermal_bias.sc 0.026 -0.186 0.122 -0.028 -0.006 -0.369 -0.014
tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc. tmptrnd_bs.sc:ms.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc 0.453
temptrend_abs.sc:mass.sc 0.028 0.039
temptrend_abs.sc:speed.sc -0.029 -0.063 -0.439
temptrend_abs.sc:consumerfrac.sc -0.017 0.081 0.549
temptrend_abs.sc:nspp.sc -0.055 -0.058 0.002
tsign-1:thermal_bias.sc 0.198 0.050 0.011
tsign1:thermal_bias.sc 0.496 0.298 0.021
temptrend_abs.sc:npp.sc 0.078 0.074 0.011
temptrend_abs.sc:veg.sc 0.016 -0.034 -0.028
temptrend_abs.sc:duration.sc 0.012 -0.038 -0.011
temptrend_abs.sc:human_bowler.sc 0.066 0.201 -0.080
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.305 -0.022 0.054
temptrend_abs.sc:tsign1:thermal_bias.sc -0.615 -0.339 -0.018
tmptrnd_bs.sc:sp. tmptrnd_bs.sc:c. tmptrnd_bs.sc:ns. t-1:_.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc -0.699
temptrend_abs.sc:nspp.sc -0.032 0.012
tsign-1:thermal_bias.sc -0.014 -0.061 0.022
tsign1:thermal_bias.sc -0.027 0.039 0.049 0.281
temptrend_abs.sc:npp.sc 0.033 -0.034 -0.024 -0.123
temptrend_abs.sc:veg.sc 0.147 -0.097 -0.050 0.076
temptrend_abs.sc:duration.sc -0.015 0.043 -0.259 0.026
temptrend_abs.sc:human_bowler.sc -0.030 -0.066 -0.053 -0.040
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.045 0.083 -0.009 -0.457
temptrend_abs.sc:tsign1:thermal_bias.sc 0.016 -0.024 -0.077 -0.196
ts1:_. tmptrnd_bs.sc:np. tmptrnd_bs.sc:v. tmptrnd_bs.sc:d.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc -0.152
temptrend_abs.sc:veg.sc 0.111 -0.609
temptrend_abs.sc:duration.sc -0.064 -0.005 0.004
temptrend_abs.sc:human_bowler.sc -0.044 -0.180 0.418 -0.105
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.267 0.311 -0.156 -0.092
temptrend_abs.sc:tsign1:thermal_bias.sc -0.831 0.198 -0.155 0.085
tmptrnd_bs.sc:h_. t_.:-1
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
veg.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc
temptrend_abs.sc:duration.sc
temptrend_abs.sc:human_bowler.sc
temptrend_abs.sc:tsign-1:thermal_bias.sc 0.169
temptrend_abs.sc:tsign1:thermal_bias.sc 0.038 0.319
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.32506581 -0.38770014 -0.04491269 0.36618931 5.19217938
Number of Observations: 2299
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
90 2299
summary(modTfullHornFresh)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 3.088553e-08 (Intr)
temptrend_abs.sc 2.055026e-02 0.025
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.02085277 2.44783
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.345198
Fixed effects: Horntrendrem0 ~ temptrend_abs.sc * tsign + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * veg.sc + temptrend_abs.sc * duration.sc + temptrend_abs.sc * human_bowler.sc
Correlation:
(Intr) tmpt_. tsign1 tmpv_. ses.sc mcrcl. mss.sc spd.sc nspp.s
temptrend_abs.sc -0.602
tsign1 -0.231 0.096
tempave_metab.sc 0.484 -0.185 0.121
seas.sc 0.008 -0.055 0.022 0.354
microclim.sc -0.132 0.056 0.107 0.381 0.099
mass.sc -0.034 0.042 -0.073 -0.301 0.196 -0.393
speed.sc 0.241 -0.155 0.004 0.232 0.111 0.078 -0.670
nspp.sc 0.125 -0.007 -0.163 -0.343 -0.442 -0.166 0.205 -0.078
npp.sc -0.272 -0.025 0.019 -0.132 0.452 0.147 0.096 -0.007 -0.032
veg.sc -0.543 0.574 -0.027 -0.010 -0.068 -0.128 -0.108 0.065 -0.146
duration.sc -0.134 0.121 -0.187 0.102 -0.026 0.072 -0.112 0.023 -0.208
human_bowler.sc 0.065 0.062 -0.078 -0.106 -0.267 -0.011 0.165 -0.105 -0.048
temptrend_abs.sc:tsign1 0.171 -0.362 -0.534 -0.016 -0.013 -0.007 -0.046 0.047 0.081
temptrend_abs.sc:tempave_metab.sc -0.159 0.098 -0.029 -0.614 -0.427 -0.311 0.204 -0.189 0.196
temptrend_abs.sc:seas.sc -0.021 0.063 0.027 -0.352 -0.697 -0.152 -0.026 -0.180 0.187
temptrend_abs.sc:microclim.sc 0.039 0.000 0.013 -0.258 -0.174 -0.622 0.213 -0.074 0.034
temptrend_abs.sc:mass.sc -0.016 -0.069 -0.010 0.150 -0.015 0.239 -0.674 0.446 -0.105
temptrend_abs.sc:speed.sc -0.130 0.244 0.058 -0.123 -0.179 -0.049 0.420 -0.644 0.022
temptrend_abs.sc:nspp.sc -0.072 -0.009 0.157 0.177 0.134 0.083 -0.160 -0.005 -0.624
tsign-1:thermal_bias.sc 0.429 -0.242 -0.411 0.253 0.043 0.065 -0.035 0.048 0.091
tsign1:thermal_bias.sc 0.218 -0.069 0.138 0.581 0.367 0.124 0.040 0.015 -0.204
temptrend_abs.sc:npp.sc 0.014 0.271 0.009 -0.067 -0.351 -0.074 -0.028 -0.023 0.022
temptrend_abs.sc:veg.sc 0.354 -0.817 0.020 -0.011 0.016 0.060 0.023 -0.036 0.006
temptrend_abs.sc:duration.sc 0.043 -0.011 -0.037 0.044 0.153 0.060 0.045 0.061 0.117
temptrend_abs.sc:human_bowler.sc -0.018 -0.038 0.025 0.193 0.275 0.108 -0.232 0.190 0.007
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.223 0.440 0.187 -0.198 -0.170 -0.066 0.098 -0.065 0.040
temptrend_abs.sc:tsign1:thermal_bias.sc -0.099 0.022 -0.106 -0.344 -0.342 -0.044 -0.075 -0.026 0.075
npp.sc veg.sc drtn.s hmn_b. tm_.:1 tmptrnd_bs.sc:t_.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
nspp.sc
npp.sc
veg.sc -0.358
duration.sc 0.041 0.119
human_bowler.sc -0.123 0.057 0.041
temptrend_abs.sc:tsign1 -0.018 -0.047 0.054 -0.032
temptrend_abs.sc:tempave_metab.sc -0.151 -0.024 -0.045 0.298 -0.040
temptrend_abs.sc:seas.sc -0.353 0.010 0.000 0.322 -0.050 0.779
temptrend_abs.sc:microclim.sc -0.108 0.098 -0.008 0.118 -0.070 0.524
temptrend_abs.sc:mass.sc 0.021 0.040 0.076 -0.298 0.097 -0.376
temptrend_abs.sc:speed.sc -0.042 -0.028 0.001 0.200 -0.093 0.226
temptrend_abs.sc:nspp.sc -0.031 0.046 0.116 -0.059 -0.111 -0.251
tsign-1:thermal_bias.sc 0.126 -0.256 0.003 0.055 0.244 -0.183
tsign1:thermal_bias.sc 0.124 0.060 0.027 0.188 -0.140 -0.399
temptrend_abs.sc:npp.sc -0.690 0.340 -0.066 0.117 0.033 0.341
temptrend_abs.sc:veg.sc 0.244 -0.692 -0.075 -0.037 0.106 0.071
temptrend_abs.sc:duration.sc 0.044 -0.090 -0.342 -0.061 0.021 -0.044
temptrend_abs.sc:human_bowler.sc 0.116 0.005 -0.030 -0.709 0.056 -0.499
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.246 0.236 -0.021 0.087 -0.477 0.423
temptrend_abs.sc:tsign1:thermal_bias.sc -0.216 -0.030 0.076 -0.004 0.173 0.585
tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc. tmptrnd_bs.sc:ms.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
nspp.sc
npp.sc
veg.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc 0.397
temptrend_abs.sc:mass.sc -0.201 -0.358
temptrend_abs.sc:speed.sc 0.319 0.166 -0.674
temptrend_abs.sc:nspp.sc -0.150 -0.005 0.180
tsign-1:thermal_bias.sc -0.117 -0.061 0.052
tsign1:thermal_bias.sc -0.320 -0.052 -0.104
temptrend_abs.sc:npp.sc 0.459 0.196 -0.075
temptrend_abs.sc:veg.sc 0.032 -0.138 -0.023
temptrend_abs.sc:duration.sc -0.210 -0.189 -0.003
temptrend_abs.sc:human_bowler.sc -0.501 -0.182 0.480
temptrend_abs.sc:tsign-1:thermal_bias.sc 0.374 0.182 -0.228
temptrend_abs.sc:tsign1:thermal_bias.sc 0.520 0.087 0.003
tmptrnd_bs.sc:sp. tmptrnd_bs.sc:ns. t-1:_. ts1:_.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
nspp.sc
npp.sc
veg.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:nspp.sc 0.016
tsign-1:thermal_bias.sc -0.035 -0.028
tsign1:thermal_bias.sc 0.034 0.041 0.196
temptrend_abs.sc:npp.sc 0.013 0.050 -0.173 -0.199
temptrend_abs.sc:veg.sc 0.016 -0.022 0.144 -0.042
temptrend_abs.sc:duration.sc -0.108 -0.279 0.071 0.059
temptrend_abs.sc:human_bowler.sc -0.329 0.004 -0.006 -0.029
temptrend_abs.sc:tsign-1:thermal_bias.sc 0.072 -0.085 -0.534 -0.177
temptrend_abs.sc:tsign1:thermal_bias.sc -0.045 -0.045 -0.159 -0.711
tmptrnd_bs.sc:np. tmptrnd_bs.sc:v. tmptrnd_bs.sc:d.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
nspp.sc
npp.sc
veg.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc -0.513
temptrend_abs.sc:duration.sc -0.047 0.116
temptrend_abs.sc:human_bowler.sc -0.145 -0.075 0.053
temptrend_abs.sc:tsign-1:thermal_bias.sc 0.494 -0.339 -0.057
temptrend_abs.sc:tsign1:thermal_bias.sc 0.411 0.068 -0.056
tmptrnd_bs.sc:h_. t_.:-1
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
nspp.sc
npp.sc
veg.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:veg.sc
temptrend_abs.sc:duration.sc
temptrend_abs.sc:human_bowler.sc
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.153
temptrend_abs.sc:tsign1:thermal_bias.sc -0.145 0.337
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-4.25987257 -0.29069598 -0.02883191 0.25023757 5.23849247
Number of Observations: 608
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
18 608
summary(modTfullHornMar)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.02167793 (Intr)
temptrend_abs.sc 0.02656924 0.035
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.02055808 2.782391
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-2.432839
Fixed effects: Horntrendrem0 ~ temptrend_abs.sc * tsign + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * nspp.sc + temptrend_abs.sc * thermal_bias.sc:tsign + temptrend_abs.sc * npp.sc + temptrend_abs.sc * duration.sc + temptrend_abs.sc * human_bowler.sc
Correlation:
(Intr) tmpt_. tsign1 tmpv_. ses.sc mcrcl. mss.sc spd.sc cnsmr.
temptrend_abs.sc -0.263
tsign1 -0.188 0.115
tempave_metab.sc 0.102 -0.003 0.022
seas.sc 0.185 -0.084 -0.091 0.221
microclim.sc 0.037 -0.045 0.008 -0.204 0.067
mass.sc 0.058 -0.033 0.000 0.062 0.037 0.012
speed.sc 0.153 -0.080 -0.079 0.072 0.073 0.039 -0.434
consumerfrac.sc 0.000 0.012 0.029 -0.068 -0.012 0.012 -0.055 0.000
nspp.sc -0.131 0.096 0.058 -0.114 0.092 -0.084 -0.105 0.204 0.112
npp.sc -0.043 0.057 -0.002 -0.053 -0.345 -0.238 -0.024 0.081 -0.040
duration.sc 0.041 -0.022 -0.137 0.053 -0.064 -0.016 -0.001 -0.016 -0.016
human_bowler.sc -0.030 0.030 0.005 0.098 -0.193 0.005 -0.026 0.040 -0.055
temptrend_abs.sc:tsign1 0.089 -0.249 -0.520 -0.048 -0.009 -0.003 0.008 0.032 -0.017
temptrend_abs.sc:tempave_metab.sc -0.031 0.078 -0.081 -0.437 -0.161 0.032 -0.019 0.058 0.040
temptrend_abs.sc:seas.sc -0.078 0.140 0.048 -0.144 -0.689 -0.051 -0.018 -0.038 -0.016
temptrend_abs.sc:microclim.sc -0.022 0.066 -0.016 0.131 -0.010 -0.723 0.014 -0.028 -0.003
temptrend_abs.sc:mass.sc 0.002 0.093 0.012 -0.038 -0.016 0.026 -0.573 0.252 0.060
temptrend_abs.sc:speed.sc -0.031 0.176 0.047 0.026 -0.018 -0.039 0.237 -0.575 0.016
temptrend_abs.sc:consumerfrac.sc -0.013 -0.027 -0.018 0.051 0.006 0.017 0.052 0.007 -0.719
temptrend_abs.sc:nspp.sc 0.038 -0.174 -0.024 0.031 -0.065 0.046 0.026 -0.170 -0.064
tsign-1:thermal_bias.sc 0.037 0.000 -0.166 0.241 -0.140 -0.031 -0.046 0.047 -0.004
tsign1:thermal_bias.sc 0.006 -0.004 0.129 0.432 -0.171 -0.128 -0.002 0.027 -0.005
temptrend_abs.sc:npp.sc 0.007 -0.082 0.014 0.031 0.208 0.182 -0.009 -0.036 0.014
temptrend_abs.sc:duration.sc -0.104 0.249 0.028 0.111 0.011 -0.038 0.036 0.016 0.030
temptrend_abs.sc:human_bowler.sc 0.029 -0.029 -0.017 -0.067 0.145 -0.007 0.023 -0.033 0.133
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.012 0.010 0.028 -0.091 0.105 0.023 0.013 0.009 -0.003
temptrend_abs.sc:tsign1:thermal_bias.sc 0.006 -0.004 -0.104 -0.174 0.072 0.038 0.012 0.042 -0.019
nspp.s npp.sc drtn.s hmn_b. tm_.:1 tmptrnd_bs.sc:t_.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc -0.237
duration.sc -0.279 0.065
human_bowler.sc -0.051 -0.158 0.018
temptrend_abs.sc:tsign1 -0.036 -0.002 0.018 -0.006
temptrend_abs.sc:tempave_metab.sc 0.038 0.018 0.022 -0.044 0.092
temptrend_abs.sc:seas.sc -0.057 0.261 0.016 0.155 0.013 0.196
temptrend_abs.sc:microclim.sc 0.052 0.180 0.004 -0.028 -0.019 0.029
temptrend_abs.sc:mass.sc 0.028 -0.019 0.033 0.031 -0.013 0.041
temptrend_abs.sc:speed.sc -0.167 -0.017 0.027 -0.043 -0.019 -0.156
temptrend_abs.sc:consumerfrac.sc -0.087 0.016 -0.004 0.075 0.046 -0.049
temptrend_abs.sc:nspp.sc -0.643 0.144 0.179 0.044 0.032 -0.064
tsign-1:thermal_bias.sc -0.055 -0.011 0.077 0.141 0.042 -0.054
tsign1:thermal_bias.sc -0.059 -0.118 0.093 0.170 -0.076 -0.125
temptrend_abs.sc:npp.sc 0.133 -0.656 -0.036 0.097 -0.050 -0.027
temptrend_abs.sc:duration.sc 0.253 -0.038 -0.484 0.034 -0.079 -0.042
temptrend_abs.sc:human_bowler.sc 0.039 0.105 -0.005 -0.735 0.018 0.089
temptrend_abs.sc:tsign-1:thermal_bias.sc 0.008 -0.003 -0.030 -0.083 0.059 0.277
temptrend_abs.sc:tsign1:thermal_bias.sc 0.015 0.082 -0.046 -0.122 0.164 0.469
tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc. tmptrnd_bs.sc:ms.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc 0.053
temptrend_abs.sc:mass.sc 0.005 -0.063
temptrend_abs.sc:speed.sc 0.067 0.051 -0.412
temptrend_abs.sc:consumerfrac.sc -0.029 -0.039 -0.112
temptrend_abs.sc:nspp.sc 0.061 -0.014 -0.009
tsign-1:thermal_bias.sc 0.091 0.011 0.023
tsign1:thermal_bias.sc 0.065 0.049 0.017
temptrend_abs.sc:npp.sc -0.379 -0.338 0.065
temptrend_abs.sc:duration.sc -0.046 0.044 -0.068
temptrend_abs.sc:human_bowler.sc -0.171 -0.022 -0.025
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.127 -0.034 -0.014
temptrend_abs.sc:tsign1:thermal_bias.sc -0.069 -0.123 -0.016
tmptrnd_bs.sc:sp. tmptrnd_bs.sc:c. tmptrnd_bs.sc:ns. t-1:_.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc -0.042
temptrend_abs.sc:nspp.sc 0.212 0.115
tsign-1:thermal_bias.sc -0.015 -0.001 0.009
tsign1:thermal_bias.sc -0.004 0.002 0.000 0.358
temptrend_abs.sc:npp.sc -0.012 -0.003 -0.152 -0.005
temptrend_abs.sc:duration.sc -0.044 0.024 -0.356 -0.028
temptrend_abs.sc:human_bowler.sc 0.038 -0.153 -0.057 -0.092
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.047 0.029 -0.009 -0.482
temptrend_abs.sc:tsign1:thermal_bias.sc -0.124 0.050 -0.033 -0.177
ts1:_. tmptrnd_bs.sc:np. tmptrnd_bs.sc:d. tmptrnd_bs.sc:h_.
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc 0.086
temptrend_abs.sc:duration.sc -0.055 0.054
temptrend_abs.sc:human_bowler.sc -0.124 -0.140 -0.020
temptrend_abs.sc:tsign-1:thermal_bias.sc -0.174 0.011 0.066 0.087
temptrend_abs.sc:tsign1:thermal_bias.sc -0.571 -0.084 0.037 0.137
t_.:-1
temptrend_abs.sc
tsign1
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
consumerfrac.sc
nspp.sc
npp.sc
duration.sc
human_bowler.sc
temptrend_abs.sc:tsign1
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:consumerfrac.sc
temptrend_abs.sc:nspp.sc
tsign-1:thermal_bias.sc
tsign1:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:duration.sc
temptrend_abs.sc:human_bowler.sc
temptrend_abs.sc:tsign-1:thermal_bias.sc
temptrend_abs.sc:tsign1:thermal_bias.sc 0.341
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.59847381 -0.21790065 -0.02487884 0.21515504 5.76491820
Number of Observations: 32420
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
92 32420
Also uses the full models across all realms
coefs1 <- summary(modTfullHornrem0)$tTable
coefs2 <- summary(modTfullHornTerr)$tTable
coefs3 <- summary(modTfullHornFresh)$tTable
coefs4 <- summary(modTfullHornMar)$tTable
varstoplot <- unique(c(rownames(coefs1), rownames(coefs2), rownames(coefs3), rownames(coefs4)))
varstoplot <- varstoplot[which(!grepl('Intercept', varstoplot) | grepl(':', varstoplot))] # vars to plot
rows1_1 <- which(rownames(coefs1) %in% varstoplot) # rows in coefs
rows1_2 <- which(rownames(coefs2) %in% varstoplot)
rows1_3 <- which(rownames(coefs3) %in% varstoplot)
rows1_4 <- which(rownames(coefs4) %in% varstoplot)
xlims <- range(c(coefs1[rows1_1,1] - coefs1[rows1_1,2], coefs1[rows1_1,1] + coefs1[rows1_1,2],
coefs2[rows1_2,1] - coefs2[rows1_2,2], coefs2[rows1_2,1] + coefs2[rows1_2,2],
coefs3[rows1_3,1] - coefs3[rows1_3,2], coefs3[rows1_3,1] + coefs3[rows1_3,2],
coefs4[rows1_4,1] - coefs4[rows1_4,2], coefs4[rows1_4,1] + coefs4[rows1_4,2]))
cols <- brewer.pal(4, 'Dark2') # for full, terr, fresh, mar
pchs <- c(1, 16, 16, 16)
offs <- c(0.1, 0, -0.1, -0.2) # offset vertically for each model
par(las = 1, mai = c(0.5, 4, 0.1, 0.1))
plot(0,0, col = 'white', xlim = xlims, ylim = c(1,length(varstoplot)), yaxt='n', xlab = '', ylab ='')
axis(2, at = length(varstoplot):1, labels = varstoplot, cex.axis = 0.7)
abline(v = 0, col = 'grey', lty = 2)
abline(h = 1:length(varstoplot), col = 'grey', lty = 3)
for(i in 1:length(varstoplot)){
if(varstoplot[i] %in% rownames(coefs1)){
x = coefs1[rownames(coefs1) == varstoplot[i], 1]
se = coefs1[rownames(coefs1) == varstoplot[i], 2]
points(x, length(varstoplot) + 1 - i + offs[1], pch = pchs[1], col = cols[1])
lines(x = c(x-se, x+se), y = c(length(varstoplot) + 1 - i + offs[1], length(varstoplot) + 1 - i + offs[1]), col = cols[1])
}
if(varstoplot[i] %in% rownames(coefs2)){
x = coefs2[rownames(coefs2) == varstoplot[i], 1]
se = coefs2[rownames(coefs2) == varstoplot[i], 2]
points(x, length(varstoplot) + 1 - i + offs[2], pch = pchs[2], col = cols[2])
lines(x = c(x-se, x+se), y = c(length(varstoplot) + 1 - i + offs[2], length(varstoplot) + 1 - i + offs[2]), col = cols[2])
}
if(varstoplot[i] %in% rownames(coefs3)){
x = coefs3[rownames(coefs3) == varstoplot[i], 1]
se = coefs3[rownames(coefs3) == varstoplot[i], 2]
points(x, length(varstoplot) + 1 - i + offs[3], pch = pchs[3], col = cols[3])
lines(x = c(x-se, x+se), y = c(length(varstoplot) + 1 - i + offs[3], length(varstoplot) + 1 - i + offs[3]), col = cols[3])
}
if(varstoplot[i] %in% rownames(coefs4)){
x = coefs4[rownames(coefs4) == varstoplot[i], 1]
se = coefs4[rownames(coefs4) == varstoplot[i], 2]
points(x, length(varstoplot) + 1 - i + offs[4], pch = pchs[4], col = cols[4])
lines(x = c(x-se, x+se), y = c(length(varstoplot) + 1 - i + offs[4], length(varstoplot) + 1 - i + offs[4]), col = cols[4])
}
}
legend('bottomleft', col = cols, pch = pchs, lwd = 1, legend = c('All', 'Terestrial', 'Freshwater', 'Marine'))
[End text in hopes this helps the last figure show up when knitted]